package com.gzyj.jtt808.v2011.additionalinfo;


import com.gzyj.jtt808.utils.HexBytesUtil;
import io.netty.buffer.ByteBuf;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 视频相关报警
 *
 * @author lhj
 */
@Data
@ApiModel("视频信号遮挡报警状态")
public class JTT808_0x0200_0x16 extends JTT808_AddtionalInfo implements Serializable {

    @ApiModelProperty("视频信号遮挡报警状态")
    private Long VideoSignalOcclusionAlarmStatus;


    public JTT808_0x0200_0x16() {
        this.setID(0x16);
        this.setLength(4);
    }

    @Override
    public void encode(ByteBuf buf) {
        buf.writeByte(this.getID());
        buf.writeByte(4);
        buf.writeInt(this.VideoSignalOcclusionAlarmStatus.intValue());
    }

    @Override
    public JTT808_0x0200_0x16 decode(ByteBuf buf) {
        byte[] temp = HexBytesUtil.readByOffset(buf, 1);
        this.setLength(Integer.parseInt(HexBytesUtil.bytesToHex(temp), 16));
        this.VideoSignalOcclusionAlarmStatus=buf.readUnsignedInt();
        return this;
    }
}
